
// 1.实现枚举类，表示日志等级
// 2.提供枚举类转字符串接口

#ifndef __LEVEL__
#define __LEVEL__

#include <string>

namespace log
{
    class log_level
    {
    public:
        enum level
        {
            UNKNOW = 0,
            DEBUG,
            INFO,
            WARN,
            ERROR,
            FATAL,
            OFF
        };

        static std::string to_string(const level& l)
        {
            switch(l)
            {
                case level::DEBUG:
                    return "DEBUG";
                case level::INFO:
                    return "INFO";
                case level::WARN:
                    return "WARN";
                case level::ERROR:
                    return "ERROR";
                case level::FATAL:
                    return "FATAL";
                case level::OFF:
                    return "OFF";
                default:
                    return "UNKNOW";
            }

            return "UNKNOW";
        }
    };
}

#endif